package android.fin;

import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;


public class ClimayLugarHandler extends DefaultHandler {

	private HoraTemperatura horaTemperatura = null;

	public HoraTemperatura getHoraTemperatura() {
		return this.horaTemperatura;
	}

	@Override
	public void startDocument() throws SAXException {
		this.horaTemperatura = new HoraTemperatura();
	}

	@Override
	public void endDocument() throws SAXException {
	}

	@Override
	public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException {
		
		String data = atts.getValue("data");
		
		if(localName.equals("temp_c")){
			this.horaTemperatura.setTemperatura(data);
		}else{
			if(localName.equals("postal_code")){
				this.horaTemperatura.setCiudad(data);
			}
		}
	}
	

	@Override
	public void endElement(String namespaceURI, String localName, String qName) throws SAXException {
	}

	@Override
	public void characters(char ch[], int start, int length) {
	}
}
